define(['app'], function(app) {
    'use strict';
    //实例化方法
    var factory = function (Http) {
        /**
         * 一键切换数据获取方式
         * @param {Object} result
         */
        function get_data_getvideolist(result) {
            if (false) {
                result = '{"success":true,"msg":"","result":{"video":[{"id":"001","goods_id":"001","name":"螺丝刀","count":10,"video":"001.mp3","profile":"螺丝刀介绍","apply_time":"2017-03-10"},{"id":"002","goods_id":"001","name":"螺丝刀","count":10,"video":"002.mp3","profile":"螺丝刀介绍","apply_time":"2017-03-10"}]},"session":"7311da98bd0f18eb15a96bcb263f4153"}';
                return JSON.parse(result);
            }
            else {
                return result;
            }
        }
        
        //返回信息
        return {
            //产品视频一览
            getlist: function (key, cat_type_id,order, video_type, nPage,pagelimit, callback,calldone) {
                Http.post({
                    method: 'goods.video.getlist', 
                    key: key, 
                    cat_type_id: cat_type_id,
                    order: order, 
                    video_type: video_type,
                    nPage:nPage,
                    pagelimit:pagelimit
                }, function (result) {
                    //请求成功
                    if (callback) {
                        callback(get_data_getvideolist(result).result);
                    }
                }, function (e) {
                    //请求异常
                }, function () {
                    //请求完成，一般不做什么事情
                    if(calldone)
						calldone();
                });
            }
        }
    }
    factory.$inject = ['Http'];
    return app.registerService("Proconsultservice", factory);
});